-- Decompiled with the Synapse X Luau decompiler.
local ClientOHOH = _G.ClientOHOH

local CommonOHOH = _G.CommonOHOH;

local M = ClientOHOH.class.new(script, ClientOHOH.files.CharacterObject());
local HttpService = game:GetService("HttpService")
local Tool=require(script.Parent.Parent.Parent.tool)
local Bro_Cfg=_G.CommonOHOH.config.Bro

function M.new(self, ...)
	return M(self, ...);
end;

function M.ctor(self,character,userId,chaperId,levelId,root)

    self.TryFeedEvent= _G.CommonOHOH.load.Connect().new() --准备投喂

    self.FeedEvent= _G.CommonOHOH.load.Connect().new() --开始投喂
    self.AwakeEvent= _G.CommonOHOH.load.Connect().new() --觉醒了
    self.DtorEvent= _G.CommonOHOH.load.Connect().new() --销毁

    self.userId=userId
    self.chaperId=chaperId
    self.levelId=levelId
    self.root=root
    self.guid=HttpService:GenerateGUID(false)

    self.cfg=Bro_Cfg[Tool.Calculate_cfg_level2(self.chaperId,self.levelId,1)]



	M.super.ctor(self, character);
    CommonOHOH.load.ColliderManager():SetAllGroup(self.main_inst, CommonOHOH.load.ColliderGroup().character);

    self:GetRootPart_Loop().Anchored=true

    local att=ClientOHOH:GetPath_Loop("Touch.friend",root)
    self:SetCFrame(att.WorldCFrame)

    local descriptionCfg={
		BodyTypeScale=root.body.BodyTypeScale.Value,
		DepthScale=root.body.DepthScale.Value,
		HeadScale=root.body.HeadScale.Value,
		HeightScale=root.body.HeightScale.Value,
		ProportionScale=root.body.ProportionScale.Value,
		WidthScale=root.body.WidthScale.Value,
	}

    local humanoid=self:GetHumanoid()

    local description = self.humanoid:GetAppliedDescription()
	for k,v in pairs(descriptionCfg) do
		description[k]=v
	end

    humanoid.DisplayDistanceType=Enum.HumanoidDisplayDistanceType.None
	humanoid:ApplyDescription(description)

    self:AddPrivateComponentByFolder(script.com)
end;

function M.GetCfg(self)
    return  self.cfg
end

function M.GetRoot(self)
    return self.root
end

function M.GetId(self)
    return self.guid
end

function M.dtor(self)
    self.DtorEvent:Action(self)
    self.AwakeEvent:dtor()
    self.FeedEvent:dtor()
    self.DtorEvent:dtor()

    local obj=nil
    if  self.main_inst then
        obj=self.main_inst
        -- self.main_inst:Destroy()
        -- self.main_inst=nil
    end

	M.super.dtor(self);
    if obj then
        obj:Destroy()
    end
end;


return M;
